package com.kgc.study;

public class TestPet {
    //多态性：提高代码灵活性
    //召集所有的宠物集中在一起模拟自我介绍
    public static void say(Pet[] pets){
        if(pets == null) return;
        for (Pet pet : pets) {
            pet.print();
            System.out.println("============================华丽分割线=================================");
        }
    }

    public static void main(String[] args) {
        Pet[] pets = new Pet[]{
                new Cat("小花猫",40,80,"黄色"),
                new Dog("Kimi",100,90,"哈士奇"),
                new Dog("欧欧",45,70,"中华田园犬"),
                new Penguin("楠楠",20,60,"Q妹")
        };
        say(pets);

        Master wang = new Master("老王",3000);
        wang.cure(new Cat("小花猫",40,80,"黄色"));
        wang.cure(new Dog("欧欧",45,70,"中华田园犬"));
        wang.cure(new Penguin("楠楠",20,60,"Q妹"));



    }
}
